var UIPanel_Tuiguang = (function () {
    function UIPanel_Tuiguang() {
        this.panel = null;

    }

    var __proto = UIPanel_Tuiguang.prototype;
    __proto.init = function () {
        var btn_back = this.panel.getChild("btn_back");
        btn_back.onClick(this, function () {
            this.panel.visible = false;
        });
        this.ctl_switch = this.panel.getController("ctl_switch");

        this.gold = this.panel.getChild("gold");
        this.yesterdayGold = this.panel.getChild("yesterdayGold");
        this.todayGold = this.panel.getChild("todayGold");
        this.yesterdayPlayer = this.panel.getChild("yesterdayPlayer");
        this.todayPlayer = this.panel.getChild("todayPlayer");

        this.btn_bottom = this.panel.getChild("btn_bottom");
        this.btn_Details = this.panel.getChild("btn_Details");
        this.btn_Friends = this.panel.getChild("btn_Friends");
        this.btn_Course = this.panel.getChild("btn_Course");

        this.Details = this.panel.getChild("Details");
        this.Friends = this.panel.getChild("Friends");
        this.Course = this.panel.getChild("Course");

        this.btn_bottom.onClick(this, function () {
        });
        this.btn_Details.onClick(this, function () {
            this.Details.visible = true;
        });
        this.btn_Friends.onClick(this, function () {
            this.Friends.visible = true;
        });
        this.btn_Course.onClick(this, function () {
            this.Course.visible = true;
        });

        this.setGold(0);
        this.setYesterdayGold(0);
        this.setTodayGold(0);
        this.setYesterdayPlayer(0);
        this.setTodayPlayer(0);
        this.initDetails();
        this.initFriends();
        this.initCourse();
    }
    __proto.initDetails = function () {
        var btn_back = this.Details.getChild("btn_back");
        var btn_thisM = this.Details.getChild("btn_thisM");
        var btn_lastM = this.Details.getChild("btn_lastM");
        var btn_all = this.Details.getChild("btn_all");

        this.DetailsList = this.Details.getChild("list");

        btn_back.onClick(this, function () {
            this.Details.visible = false;
        });
        btn_thisM.onClick(this, function () {
            console.log('本月');
        });
        btn_lastM.onClick(this, function () {
            console.log('上月');
        });
        btn_all.onClick(this, function () {
            console.log('全部');
        });
        this.initDetailsList(testData);
        this.initFriends();
        this.initCourse();
    }
    var testData = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20];
    __proto.initDetailsList = function (data) {
        this.DetailsList.removeChildren();
        for (var i in data) {
            var item = this.DetailsList.addItemFromPool();
            item.title = data[i];
            item.getChild("time").text = data[i];
            item.getChild("account").text = data[i];
            item.getChild("gold").text = data[i];
            item.getChild("state").text = '正常';
            if (i % 2 == 0) {
                item.getChild("bg").visible = false;
            }
        }
    }
    __proto.initFriends = function () {
        var btn_back = this.Friends.getChild("btn_back");
        var btn_save = this.Friends.getChild("btn_save");
        var btn_copy = this.Friends.getChild("btn_copy");
        var icon = this.Friends.getChild("icon");

        btn_back.onClick(this, function () {
            this.Friends.visible = false;
        });
        btn_save.onClick(this, function () {
            console.log('保存');

        });
        btn_copy.onClick(this, function () {
            console.log('复制');
        });
    }
    __proto.initCourse = function () {
        var btn_back = this.Course.getChild("btn_back");
        var tip = this.Course.getChild("tip");
        tip.text = '教程推广教程';
        btn_back.onClick(this, function () {
            this.Course.visible = false;
        });
    }

    __proto.setGold = function (value) {
        this.gold.text = value;
    }
    __proto.setYesterdayGold = function (value) {
        this.yesterdayGold.text = value;
    }
    __proto.setTodayGold = function (value) {
        this.todayGold.text = value;
    }
    __proto.setYesterdayPlayer = function (value) {
        this.yesterdayPlayer.text = value;
    }
    __proto.setTodayPlayer = function (value) {
        this.todayPlayer.text = value;
    }
    return UIPanel_Tuiguang;
})()
